<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="k" uri="/WEB-INF/k.tld"%>
<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>怀才进销存管理软件 - 销售前台</title>
		<jsp:include page="../inc.jsp"></jsp:include>
		<script type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript" src="../jslib/date.js"></script>
		<link href="../web/css/style.css" rel="stylesheet" type="text/css" />
		<SCRIPT language="JavaScript" type="text/javascript" src="../web/js/hdm.js"></SCRIPT>
		<SCRIPT>
		var calendar;
		$(function(){
		
			calendar = $('#calendar').calendar({
				fit : true,
				current : new Date(),
				border : false,
				onSelect : function(date) {
					$(this).calendar('moveTo', new Date());
				}
			});
			$('#beginDate').val('${BeginAudit}');
			$('#endDate').val((new Date()).pattern("yyyy-MM-dd"));
		});
		
		function logout(){
			sy.messagerConfirm('请确认', '您确定要退出前台销售？', function(r) {
				if(r){
					$.ajax({
						url : '${pageContext.request.contextPath}/loginAction!logout.html',
						type : 'get',
						success:function(){
							self.location.reload();
							if(window.opener){
								opener.location = opener.location;
							}
							window.close();
						}
					});
				}
			});
		}
		
		function _search() {
			$('#queryForm').form('submit', {
				url : '${pageContext.request.contextPath}/xsgl/noAuth_statistic.html',
				success : function(d) {
					var json = $.parseJSON(d);
					if(json.msg){
						parent.sy.messagerAlert('提示', json.msg, 'error');
						$('#total').html(0.0);
					}else
						$('#total').html(json.obj);
				}
			});
		}
		
		function _settlement(){
			$('#queryForm').form('submit', {
				url : '${pageContext.request.contextPath}/xsgl/salelistAction!noAuth_settlement.html',
				success : function(d) {
					var json = $.parseJSON(d);
					sy.messagerShow({
						msg : json.msg,
						title : '提示'
					});
					self.location.reload();
				}
			});
		}
		
		</SCRIPT>
	</head>

	<body>
		<div class="top">
			<div class="logo">
				<img src="../web/imgs/htlogo.jpg" width="480" height="47" />
			</div>
			<div class="right">
				欢迎您！${sessionInfo.loginName} [${sessionInfo.roleNames}]
				<a href="javascript:void(0)" onclick="logout()">退出登录</a>
				<a href="#">修改密码</a>
			</div>
		</div>
		<div class="content">
			<div class="right">
				<!--日历标题-->
				<div class="title">
					<img src="../web/imgs/pic1.gif" width="6" height="6" />
					日历
				</div>
				<!--/日历标题-->
				<!--日历-->
				<div style="height: 180px;">
					<div id="calendar"></div>
				</div>
				<!--/日历-->
				<!--公告+提醒-->
				<div class="title">
					<ul>
						<li id="cp1" class="cpover" onMouseOver="setTab_('cp',1,5,'cpover')">
							公告<span class="tabRefresh"><a href="javascript:void(0);" onclick="javascript:document.frames('announcementIframe').location.reload()" class="icon-mini-refresh"></a></span>
						</li>
						<li id="cp2" onMouseOver="setTab_('cp',2,5,'cpover')">
							系统提醒<span class="tabRefresh"><a href="javascript:void(0);" onclick="javascript:document.frames('warnIframe').location.reload()" class="icon-mini-refresh"></a></span>
						</li>
					</ul>
				</div>
				<div class="conts">
					<div id="cp_con1">
						<iframe width="100%" scrolling="auto" frameborder="0" onload="javascript:void(0);" name="announcementIframe" id="announcementIframe" src="${pageContext.request.contextPath}/qtmk/announcementAction!noAuth_tabAnnounce.html"></iframe>
					</div>
					<div id="cp_con2" style="display: none;">
						<iframe width="100%" scrolling="no"  frameborder="0" onload="javascript:void(0);" name="warnIframe" id="warnIframe" src="${pageContext.request.contextPath}/qtmk/remindWarnAction!noAuth_tabRemindWarn.html"></iframe>
					</div>
				</div>
				<!--/公告+提醒-->
			</div>
			<div class="left">
				<div class="nav">
					<ul>
						<k:security key="XSGL_QTXS">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/sale.html">
								<img src="${pageContext.request.contextPath}/web/imgs/navxsgl.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_XSTH">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/saleReturn.html">
								<img src="${pageContext.request.contextPath}/web/imgs/nav-xsth.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_KCCX">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/amount.html">
								<img src="${pageContext.request.contextPath}/web/imgs/nav-kcgl.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_HYGL">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/member.html">
								<img src="${pageContext.request.contextPath}/web/imgs/nav-hygl.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_RJQS">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/settlement.html">
								<img src="${pageContext.request.contextPath}/web/imgs/nav-rjqs.jpg" width="104" height="35" /> 
							</a>
						</li>
						</k:security>
						<k:security key="XSGL_XSJLCX">
						<li>
							<a href="${pageContext.request.contextPath}/xsgl/salelist.html">
								<img src="../web/imgs/navxsglcx.jpg"  height="35" /> 
							</a>
						</li>
						</k:security>
					</ul>
				</div>
				<div class="cont">
					<div style="overflow: hidden;" align="center" style="width:100%">
						<form id="queryForm" style="width: 100%">
							<table  style="width: 100%">
								<tr>
									<th align="right" >
										上一次结算时间
									</th>
									<td class="p_l">
										${EndAudit }
									</td>
								</tr>
								<tr>
									<th align="right" >
										结算仓库
									</th>
									<td class="p_l">
										<select name="rid" class="width1" id="rid"
											style="width: 200px;">
											<c:forEach items="${VRepertories}" var="VRepertory">
												<option value='${VRepertory.id }'
													<c:if test="${VRepertory.id eq rid }">selected="selected"</c:if>>
													${VRepertory.name }
												</option>
											</c:forEach>
										</select>
									</td>
								</tr>
								<tr>
									<th align="right" >
										结算时间
									</th>
									<td class="p_l">
										<input class="Wdate" name="beginDate" id="beginDate"
											onclick="WdatePicker()" readonly="readonly" />
										<input onclick="WdatePicker()" class="Wdate"
											readonly="readonly" name="endDate" id="endDate" />
										<input type="button" value="统计" onclick="_search()" />
									</td>
								</tr>
								<tr>
									<th align="right" >
										尚需结算金额
									</th>
									<td class="p_l" style="color: #033E7A;">
										<h1>
											<span id="total">${total }</span>元
										</h1>
									</td>
								</tr>
								<tr>
									<td colspan="2" style="padding:12px 0 4px 260px;">
										<input type="button" value="结算" onclick="_settlement()" class="button2 dis_block fl m_l bornon"/>
									</td>
								</tr>
							</table>
						</form>
					</div>
				</div>
			</div>
		</div>
		<div class="foot">
			Copyright @ 2013
			<a style="color:#FFFFFF; text-decoration:none;" target="_blank" href="http://www.miitbeian.gov.cn">浙ICP备13002014号-1</a>
			<br>
			杭州怀才商贸有限公司 
		</div>
	</body>
</html>
